import $api from '.';

interface Gift {
  name: string;
  number: number | string;
  [key: string]: any;
}

// 添加商品
export const addGift = function (data: Gift) {
  return $api.post('/gift', data);
};

// 获取商品列表
export const giftList = function (data: { $limit: number; $skip: number }) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/gift', {
    params: data,
  });
};

// 删除商品
export const delGift = function (id: number) {
  return $api.delete(`/gift/${id}`);
};

// 修改商品信息
export const updateGift = function (id: number, data: any) {
  return $api.patch(`/gift/${id}`, data);
};

export default {};
